<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>图书后台管理系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="../Xadmin/css/font.css">
    <link rel="stylesheet" href="../Xadmin/css/xadmin.css">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <!-- <link rel="stylesheet" href="./css/theme5.css"> -->
    <script src="../layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../Xadmin/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script>
        var is_remember = false;
    </script>
</head>
<body>
<div class="layui-form-item">
    <label class="layui-form-label">省份：</label>
    <div class="layui-input-block">
        <input class="layui-input" name="province" id="province" autocomplete="off" style="width: 30rem;" />
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">城市：</label>
    <div class="layui-input-block">
        <input class="layui-input" name="city" id="city" autocomplete="off" style="width: 30rem;" />
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">县区：</label>
    <div class="layui-input-block">
        <input class="layui-input" name="county" id="county" autocomplete="off" style="width: 30rem;"/>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">身份证：</label>
    <div class="layui-input-block">
        <input class="layui-input" name="cardid" id="cardid" autocomplete="off" style="width: 30rem;" />
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">姓名：</label>
    <div class="layui-input-block">
        <input class="layui-input" name="username" id="username" autocomplete="off" style="width: 30rem;" />
    </div>
</div>
<button class="layui-btn" style="margin-left:20rem" onclick="upUser()">更新</button>
</body>
<script>

    layui.use('layer', function () {
        console.log('layer导入成功！')
    })
    $(function (){
        $('#province').val(localStorage.getItem("province"));
        $('#city').val(localStorage.getItem("city"));
        $('#county').val(localStorage.getItem("county"));
        $('#cardid').val(localStorage.getItem("cardid"));
        $('#username').val(localStorage.getItem("username"));//本地存储
    })
    function upUser(){
        $.ajax({
            url:"http://127.0.0.1:8081/User/User",
            method:"put",
            data:{
                uname:'',
                email:'',
                upwd:'',
                phone:'',
                province:$("#province").val(),
                city:$("#city").val(),
                county:$("#county").val(),
                cardid:$("#cardid").val(),
                avatar:'',
                username:$("#username").val(),
                sex:'',
                autograph:'',
                online:localStorage.getItem("online"),
                age:localStorage.getItem("age"),
                type:localStorage.getItem("type"),
                islive:localStorage.getItem("islive"),
                isvolunteer:localStorage.getItem("isvolunteer"),
                status:localStorage.getItem("status"),
                id:localStorage.getItem("id")
            },
            success: function (res) {
                var object = JSON.parse(res)
                if (object.code === '0') {
                    layer.alert("修改成功")
                } else {
                    layer.alert("修改失败")
                }
                reload()
            }
        })
    }

</script>
</html>